package com.example.blog.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.blog.dto.UserDTO;
import com.example.blog.entity.User;
import com.example.blog.lang.Result;
import com.example.blog.mapper.UserMapper;
import com.example.blog.vo.UserVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.UUID;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author anonymous
 * @since 2021-12-15
 */
@CrossOrigin
@RestController
public class LoginController {

    private static final Logger log = LoggerFactory.getLogger(LoginController.class);
    @Autowired
    private UserMapper userMapper;

    @PostMapping("/login2")
    public Result<UserVO> login(@RequestBody UserDTO userDTO, HttpServletResponse response, HttpSession session){
        String password = DigestUtils.md5DigestAsHex(userDTO.getPassword().getBytes());
        String password1 = userMapper.getPassword(userDTO.getUsername(), password);
        return new Result<>();
    }

}
